<template>
  <div>
    <!-- 商品列表 -->
    <div class="shop-list" style="background: #f4f4f4; margin: 0.5rem 0">
      <div
        v-for="(item, index) in arr"
        :key="index"
        style="width: 20%; padding: 0 1rem"
        :style="index == 2 ? '' : 'border-right:1px solid #ccc'"
        @click="NumberChange(index)"
      >
        <div
          :class="arrNum == index ? 'shop-list1' : ''"
          style="text-align: center; margin-bottom: 0.3rem"
        >
          {{ item.title }}
        </div>
        <div
          :class="arrNum == index ? 'shop-list2' : ''"
          style="font-size: 0.8rem; text-align: center"
        >
          {{ item.name }}
        </div>
      </div>
    </div>
    <div v-for="(item,index) in 3" :key="item"><CommonList :Type = index+1 v-show="arrNum == index" /></div>
  </div>
</template>

<script>
import { GetHomeGoodsList } from "../api/xly-api";
import CommonList from "../components/CommonList.vue";
export default {
  data() {
    return {
      arr: [
        {
          title: "全部",
          name: "猜你喜欢",
        },
        {
          title: "视频",
          name: "产品更直观",
        },
        {
          title: "便宜好货",
          name: "低价抢购",
        },
      ],
      arrNum: 0,
    };
  },
  components: {
    CommonList,
  },
  methods: {
    NumberChange(index) {
      console.log(index);
      this.arrNum = index;
    },
    goToDetail(id){
      this.$router.push({path:"/detail",query:{detailId:id}});
    }
  },
};
</script>
<style src='../assets/css/CommList.css' scoped>
</style>
<style lang="less" scoped>
.shop-list {
  display: flex;
}
.shop-list1 {
  color: #ee0a24;
}
.shop-list2 {
  background-image: linear-gradient(90deg, #f60, #fb2020);
  background-color: #ee0a24;
  border-radius: 1rem;
  color: #fff;
}
.m-goods-title {
  height: 3rem;
}
.commonList {
  font-size: 20px;
  padding: 0 5px;
  background-color: #eee;
}
.van-cell__value--alone {
  border-radius: 0.7rem;
  overflow: hidden;
}
.van-cell {
  width: 50%;
  display: inline-block;
  padding: 5px;
  border-radius: 0.7rem;
  overflow: hidden;
  background-color: #eee;
}
.m-goods {
  background-color: #fff;
  /* padding: .2rem; */
}
.m-goods__tag {
  margin-right: 0.20667rem;
  display: inline-block;
  color: #fff;
  font-size: 0.7em;
  font-weight: 400;
  line-height: 1rem;
  padding: 0 0.30667rem;
  border-radius: 0.20667rem;
  vertical-align: 0.5333rem;
  background-color: #ee0a24;
  position: relative;
  top: 0.44rem;
}
.m-goods-title {
  padding: 0.21333rem 0.5rem;
  display: -webkit-box;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.van-nav-bar {
  height: 2rem;
}
.m-goods-emails {
  display: flex;
  justify-content: space-between;
  height: 1.2rem;
  padding: 0 0.5rem;
}
.m-goods-email {
  border: 1px solid #ee0a24;
  border-radius: 0.6rem;
  padding: 0 0.2rem;
  line-height: 1.1rem;
  margin: 0;
  color: #ee0a24;
  font-size: 0.6rem;
  margin-right: 0.2rem;
}
.m-goods-detail {
  margin: 0;
  color: #969799;
  font-size: 0.6rem;
}
.m-price__integer {
  color: #ee0a24;
  font-size: 1rem;
}
.m-price__currency {
  font-size: 0.6rem;
  color: #ee0a24;
}
.m-goods-pros {
  display: flex;
  padding: 0 0.5rem;
}
.m-goods-already {
  color: #969799;
  font-size: 0.6rem;
  margin-left: 0.5rem;
  position: relative;
  top: 0.044rem;
}
.m-goods-manjian {
  display: flex;
}
</style>